"""
@author: chy
@file: 导入excel.py
@time: 2023/12/4 10:02
"""
import pandas as pd

try:
    stu_data = pd.read_excel('test.xlsx',engine='openpyxl')
    stu_dict = stu_data.to_dict()
    age_dict = stu_dict.get("年龄")
    age_lst = list(age_dict.values())
    averge = sum(age_lst)/len(age_lst)
    print(f"导入的excel表格数据中的年龄分别为{age_lst}\n平均年龄为：{averge}")
except:
    print("未找到excel数据")